package com.jason.common.error;

public enum BusinessErrorEnum implements CommonError{
    // 10000 系统错误
    PARAM_ILLEGAL_ERROR("10000","参数不合法"),
    UNKNOWN_ERROR("10001","未知错误"),
    OUT_OF_RANGE("10002", "数据超出范围"),

    // 20000 用户相关错误
    USER_NOT_EXIST("20000","用户不存在"),
    CODE_NOT_VALID("20001","验证码不合法"),
    USER_AUTH_FAILED("20002","用户认证失败"),

    // 30000 交易相关错误
    TREASURE_NOT_EXIST("30000","商品不存在"),
    STOCK_NOT_ENOUGH("30001","库存不足"),
    ;


    BusinessErrorEnum(String errCode, String errMsg) {
        this.errCode = errCode;
        this.errMsg = errMsg;
    }

    private String errCode;
    private String errMsg;

    @Override
    public String getErrCode() {
        return errCode;
    }

    @Override
    public String getErrMsg() {
        return errMsg;
    }
    @Override
    public CommonError setErrMsg(String errMsg) {
        this.errMsg = errMsg;
        return this;
    }
}
